package work.linruchang.bean;

import lombok.Data;
import lombok.ToString;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@NamedQueries({
})
@Table(name="ct_user_bind_info")
public class UserBindInfo extends BaseEntity {

	private static final long serialVersionUID = 4370057088332727818L;

	String[] names2;
	List<String> names;

	private User user;
	private Landlord landlord;


	private String userMobile;
	private String areaCode;
	private String regionCode;
	private String mscCode;

	private String onu;  //线路编码

	//===========六元组信息===============
	private String slot;
	private String subslot;
	private String port;
	private String ctNasIp;
	private String ctXpi;
	private String ctXci;
	//==========================

	private Long landlordId;
	private String landlordMobile;
	private Long buildingId;

	private Date createTime;
	private Date updateTime;

	//该用户最后绑定线路标识  1：最后绑定，0：不是最后绑定
	private String userLastBind;


	/**
	 * 定时任务ReadCtbbBindTimer根据六元组还是五元组信息查到的房东视图   数据库存储值【T5、T6】
	 *
	 * 其他存储值代表暂不清楚
	 */
	private String matchFlag;
	@Column(name="room_number")
	private String roomNumber;//房间编号

	@Entity
	@NamedQueries({
	})
	@Table(name = "v_user")
	@Data
	@ToString(callSuper = true)
	public class User extends BaseEntity {

		private static final long serialVersionUID = -1591685848660375009L;
		private String name;
		private String username;
		private String password;
		private String birthday;
		private String email;
		private String phone;
		private String gender;
		/**
		 * -1未开通激活 0正常 1是加锁
		 * 参考{Constants#USER_STATUS_IS_LOCKED}等状态码
		 */
		private Integer status;
		private Date regDate;
		private Date loginDate;
		private Date updateDate;

		/**
		 * 角色主键ID
		 */
		private Long userRole;

		/**
		 * 市编码
		 */
		private String areaCode; // 地区代码 (新增)
		/**
		 * 具体在市哪个区/县编码
		 */
		private String regionCode;
		private String mscCode;
		/**
		 * 近期使用密码1
		 */
		private String pass1;
		/**
		 * 近期使用密码2
		 */
		private String pass2;
		/**
		 * 近期更换密码时间
		 */
		private Date passUpdateDate;
	}

	@Entity
	@NamedQueries({
	})
	@Table(name="ct_landlord_reg_info")
	@Data
	public class Landlord extends BaseEntity {


		@Entity
		@Table(name = "ct_ctb_line_info")
		@NamedQueries({

		})
		public class CtbLineInfo extends BaseEntity {
			private static final long serialVersionUID = 1L;

			/**
			 * 对应楼栋ID
			 */
			@Column(name = "building_id")
			private Long buildingId;


			@Column(name = "test_account")
			private String testAccount;

			private String password;

			/**
			 * 记录创建时间
			 */
			@Temporal(TemporalType.TIMESTAMP)
			@Column(name = "create_time")
			private Date createTime;

			/**
			 * 记录更新时间
			 */
			@Temporal(TemporalType.TIMESTAMP)
			@Column(name = "update_time")
			private Date updateTime;

			/**
			 * 占用资源、线路编码   多个同一个六元组可能绑定不一样的主线编码
			 */
			private String onu;

			/**
			 * 局向
			 */
			@Column(name = "ct_direction")
			private String direction;
			/**
			 * 局向编码
			 */
			@Column(name = "ct_direction_code")
			private String directionCode;

			/**
			 * ===========六元组信息================
			 */

			/**
			 * 接入服务器IP
			 */
			@Column(name = "ct_nas_ip")
			private String ctNasIp;
			/**
			 * xci
			 */
			@Column(name = "ct_xci")
			private String ctXci;

			/**
			 * xpi
			 */
			@Column(name = "ct_xpi")
			private String ctXpi;

			/**
			 * 端口
			 */
			private String port;

			/**
			 * 槽位
			 */
			private String slot;

			/**
			 * 子槽位
			 */
			private String subslot;
			/**
			 * ===========================
			 */

			/**
			 * 备注
			 */
			private String mark;

			/**
			 * 揽装人工号 == CRM的销售渠道编码
			 */
			private String decorateNum;

			/**
			 * 标准地址ID
			 */
			private String addressId;

			/**
			 * 标准地址名称
			 */
			@Column(name = "address_name")
			private String addressName;

			/**
			 * 设备编码
			 */
			private String macCode;

			/**
			 * 地市编码
			 */
			private String areaCode;


			/**
			 * 区县编码
			 */
			@Column(name = "region_code")
			private String regionCode;

			/**
			 * 营服编码
			 */
			private String mscCode;

			/**
			 * 房东ID
			 */
			private Long landlordId;

			/**
			 * 快捷送主线时的订购方式
			 * 0：默认1线多号
			 * 1：1线1号
			 *
			 * 参考{ Constants#CCLI_TYPE_MANY}
			 */
			private String type;

			/**
			 *
			 * 【已不使用】
			 * 是否强制六元组信息不随定时任务ReadCtbbBindTimer发生变更
			 * 数据库值：1true 0false 默认0
			 */
			@Column(name = "forced_sync_flag")
			private boolean forcedSyncFlag = false;

			/**
			 * 房间信息
			 */
			//private String houseInfo;

			/**
			 * 逻辑删除 == 待删除 == 记得删
			 *
			 * 1逻辑删除 0正常显示
			 */
			//Integer isDel;

			@Transient
			private Long houseId;// 翼乐居房间号
			@Transient
			private String flatName;// 翼乐居房间号
			/**
			 * 线路类型
			 * { Constants#LINE_TYPE_APARTMENT}
			 */
			@Transient
			private String lineType;
			/**
			 * 揽装人姓名
			 */
			@Transient
			private String decorateName;

			public String getType() {
				return type;
			}

			public void setType(String type) {
				this.type = type;
			}

			public String getDecorateName() {
				return decorateName;
			}

			public void setDecorateName(String decorateName) {
				this.decorateName = decorateName;
			}

			public String getLineType() {
				return lineType;
			}

			public void setLineType(String lineType) {
				this.lineType = lineType;
			}


			public CtbLineInfo() {
			}

			public String getFlatName() {
				return flatName;
			}

			public void setFlatName(String flatName) {
				this.flatName = flatName;
			}

			public Long getHouseId() {
				return houseId;
			}

			public void setHouseId(Long houseId) {
				this.houseId = houseId;
			}

			public boolean getForcedSyncFlag() {
				return forcedSyncFlag;
			}

			public void setForcedSyncFlag(boolean forcedSyncFlag) {
				this.forcedSyncFlag = forcedSyncFlag;
			}

			public Long getBuildingId() {
				return this.buildingId;
			}

			public String getDirection() {
				return direction;
			}

			public void setDirection(String direction) {
				this.direction = direction;
			}

			public String getDirectionCode() {
				return directionCode;
			}

			public String getMacCode() {
				return macCode;
			}

			public void setMacCode(String macCode) {
				this.macCode = macCode;
			}

			public void setDirectionCode(String directionCode) {
				this.directionCode = directionCode;
			}

			public String getSlot() {
				return slot;
			}

			public void setSlot(String slot) {
				this.slot = slot;
			}

			public String getSubslot() {
				return subslot;
			}

			public void setSubslot(String subslot) {
				this.subslot = subslot;
			}

			public String getPort() {
				return port;
			}

			public void setPort(String port) {
				this.port = port;
			}

			public String getTestAccount() {
				return testAccount;
			}

			public void setTestAccount(String testAccount) {
				this.testAccount = testAccount;
			}

			public String getPassword() {
				return password;
			}

			public void setPassword(String password) {
				this.password = password;
			}

			public void setBuildingId(Long buildingId) {
				this.buildingId = buildingId;
			}

			public Date getCreateTime() {
				return this.createTime;
			}

			public void setCreateTime(Date createTime) {
				this.createTime = createTime;
			}

			public String getCtNasIp() {
				return this.ctNasIp;
			}

			public void setCtNasIp(String ctNasIp) {
				this.ctNasIp = ctNasIp;
			}

			public String getCtXci() {
				return this.ctXci;
			}

			public void setCtXci(String ctXci) {
				this.ctXci = ctXci;
			}

			public String getCtXpi() {
				return this.ctXpi;
			}

			public void setCtXpi(String ctXpi) {
				this.ctXpi = ctXpi;
			}

			public Date getUpdateTime() {
				return this.updateTime;
			}

			public void setUpdateTime(Date updateTime) {
				this.updateTime = updateTime;
			}

			public String getOnu() {
				return onu;
			}

			public void setOnu(String onu) {
				this.onu = onu;
			}

			public String getMark() {
				return mark;
			}

			public void setMark(String mark) {
				this.mark = mark;
			}

			public String getDecorateNum() {
				return decorateNum;
			}

			public void setDecorateNum(String decorateNum) {
				this.decorateNum = decorateNum;
			}

			public String getAddressId() {
				return addressId;
			}

			public void setAddressId(String addressId) {
				this.addressId = addressId;
			}

			public String getAddressName() {
				return addressName;
			}

			public void setAddressName(String addressName) {
				this.addressName = addressName;
			}

			public String getAreaCode() {
				return areaCode;
			}

			public void setAreaCode(String areaCode) {
				this.areaCode = areaCode;
			}

			public String getRegionCode() {
				return regionCode;
			}

			public void setRegionCode(String regionCode) {
				this.regionCode = regionCode;
			}

			public String getMscCode() {
				return mscCode;
			}

			public void setMscCode(String mscCode) {
				this.mscCode = mscCode;
			}

			public Long getLandlordId() {
				return landlordId;
			}

			public void setLandlordId(Long landlordId) {
				this.landlordId = landlordId;
			}

			//public String getHouseInfo() {
			//    return houseInfo;
			//}
			//
			//public void setHouseInfo(String houseInfo) {
			//    this.houseInfo = houseInfo;
			//}


			@Override
			public String toString() {
				return "CtbLineInfo{" +
						"buildingId=" + buildingId +
						", testAccount='" + testAccount + '\'' +
						", password='" + password + '\'' +
						", createTime=" + createTime +
						", updateTime=" + updateTime +
						", onu='" + onu + '\'' +
						", direction='" + direction + '\'' +
						", directionCode='" + directionCode + '\'' +
						", ctNasIp='" + ctNasIp + '\'' +
						", ctXci='" + ctXci + '\'' +
						", ctXpi='" + ctXpi + '\'' +
						", port='" + port + '\'' +
						", slot='" + slot + '\'' +
						", subslot='" + subslot + '\'' +
						", mark='" + mark + '\'' +
						", decorateNum='" + decorateNum + '\'' +
						", addressId='" + addressId + '\'' +
						", addressName='" + addressName + '\'' +
						", macCode='" + macCode + '\'' +
						", areaCode='" + areaCode + '\'' +
						", regionCode='" + regionCode + '\'' +
						", mscCode='" + mscCode + '\'' +
						", landlordId=" + landlordId +
						", type='" + type + '\'' +
						", forcedSyncFlag=" + forcedSyncFlag +
						", houseId=" + houseId +
						", flatName='" + flatName + '\'' +
						", lineType='" + lineType + '\'' +
						", decorateName='" + decorateName + '\'' +
						'}';
			}
		}

		/**
		 *
		 */
		private static final long serialVersionUID = 173935594147564367L;


		private UserBindInfo userBindInfo;

		private OnuMapper onuMapper;

		private String name;

		/**
		 * 房东姓名
		 */
		@Column(name = "user_name")
		private String userName;

		/**
		 * 房东手机号
		 */
		@Column(name = "user_mobile")
		private String userMobile;

		/**
		 * 身份信息
		 */
		@Column(name = "user_id_num")
		private String userIdNum;

		/**
		 * 身份信息
		 */
		@Column(name = "certificates_type")
		private String certificatesType;
		@Column(name = "create_time")
		private Date createTime;
		@Column(name = "update_time")
		private Date updateTime;
		@Column(name = "status")
		private String status;

		/**
		 * 地市编码
		 */
		private String areaCode;

		/**
		 * 区县编码
		 */
		private String regionCode;

		/**
		 * 备注
		 */
		private String mark;

		/**
		 * 所属代理商ID
		 */
		@Column(name="agent_id")
		private Long agentId;

		/**
		 * 翼支付账号
		 */
		private String easyPayAccount;

		/**
		 * 复通次数 月份+次数+字典次数 例子：2018-08;3;30
		 */
		private String reopenTime;



	}


	public String getUserMobile() {
		return userMobile;
	}
	public void setUserMobile(String userMobile) {
		this.userMobile = userMobile;
	}
	public String getRegionCode() {
		return regionCode;
	}
	public void setRegionCode(String regionCode) {
		this.regionCode = regionCode;
	}
	public String getCtNasIp() {
		return ctNasIp;
	}
	public void setCtNasIp(String ctNasIp) {
		this.ctNasIp = ctNasIp;
	}
	public String getCtXpi() {
		return ctXpi;
	}
	public void setCtXpi(String ctXpi) {
		this.ctXpi = ctXpi;
	}
	public String getCtXci() {
		return ctXci;
	}
	public void setCtXci(String ctXci) {
		this.ctXci = ctXci;
	}
	public Long getLandlordId() {
		return landlordId;
	}
	public void setLandlordId(Long landlordId) {
		this.landlordId = landlordId;
	}
	public String getLandlordMobile() {
		return landlordMobile;
	}
	public void setLandlordMobile(String landlordMobile) {
		this.landlordMobile = landlordMobile;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	public String getOnu() {
		return onu;
	}
	public void setOnu(String onu) {
		this.onu = onu;
	}
	public String getSlot() {
		return slot;
	}
	public void setSlot(String slot) {
		this.slot = slot;
	}
	public String getSubslot() {
		return subslot;
	}
	public void setSubslot(String subslot) {
		this.subslot = subslot;
	}
	public String getPort() {
		return port;
	}
	public void setPort(String port) {
		this.port = port;
	}
	public String getAreaCode() {
		return areaCode;
	}
	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getMscCode() {
		return mscCode;
	}
	public void setMscCode(String mscCode) {
		this.mscCode = mscCode;
	}
	public String getUserLastBind() {
		return userLastBind;
	}
	public void setUserLastBind(String userLastBind) {
		this.userLastBind = userLastBind;
	}
	public Long getBuildingId() {
		return buildingId;
	}
	public void setBuildingId(Long buildingId) {
		this.buildingId = buildingId;
	}
	public String getMatchFlag() {
		return matchFlag;
	}
	public void setMatchFlag(String matchFlag) {
		this.matchFlag = matchFlag;
	}
	public String getRoomNumber() {
		return roomNumber;
	}
	public void setRoomNumber(String roomNumber) {
		this.roomNumber = roomNumber;
	}

	@Override
	public String toString() {
		return "UserBindInfo{" +
				"userMobile='" + userMobile + '\'' +
				", areaCode='" + areaCode + '\'' +
				", regionCode='" + regionCode + '\'' +
				", mscCode='" + mscCode + '\'' +
				", onu='" + onu + '\'' +
				", slot='" + slot + '\'' +
				", subslot='" + subslot + '\'' +
				", port='" + port + '\'' +
				", ctNasIp='" + ctNasIp + '\'' +
				", ctXpi='" + ctXpi + '\'' +
				", ctXci='" + ctXci + '\'' +
				", landlordId=" + landlordId +
				", landlordMobile='" + landlordMobile + '\'' +
				", buildingId=" + buildingId +
				", createTime=" + createTime +
				", updateTime=" + updateTime +
				", userLastBind='" + userLastBind + '\'' +
				", matchFlag='" + matchFlag + '\'' +
				", roomNumber='" + roomNumber + '\'' +
				'}';
	}
}